home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / telecomm / fnordadl / fn132src.zoo / cith / log.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-02  |  4.0 KB  |  124 lines

  1. /*
  2.  * log.h -- structures and defines for the Fnordadel user log
  3.  *
  4.  * 91Apr29 AA    Extracted from ctdl.h and elsewhere.
  5.  */
  6.  
  7. #ifndef _LOG_H
  8. #define _LOG_H
  9.  
  10. #define MINLOGSIZE    1
  11. #define MAXLOGSIZE    999
  12. #define SANELOGSIZE    150
  13.  
  14. #define MINMAILSLOTS    2
  15. #define MAXMAILSLOTS    999
  16. #define SANEMAILSLOTS    50
  17.  
  18. /*
  19.  * userlog stuff
  20.  */
  21. #define MAXVISIT    8    /* #visits we remember old newestLo for */
  22. #define GENSHIFT    3    /* Where the generation # is        */
  23. #define CALLMASK    7    /* For finding last visit        */
  24.  
  25. /* Following #defines robbed from Hue, Jr.'s Cit-86 */
  26. #define LB_SIZE         (sizeof (logBuf) - (PTR_SIZE * 2))
  27. #define MAIL_BULK       (MAILSLOTS * sizeof (theMessages))
  28. #define GEN_BULK        (MAXROOMS * sizeof (char))
  29. #define LB_TOTAL_SIZE   (LB_SIZE + MAIL_BULK + GEN_BULK)
  30.  
  31. struct logBuffer {        /* The appearance of a user:        */
  32.     char  lbnulls;        /* #nulls, lCase, lFeeds        */
  33.     long  flags;        /* all sorts of flags (see flags.h)    */
  34.     char  lbwidth;        /* terminal width            */
  35.     short credit;        /* Credit for long distance calls    */
  36.     LABEL lbname;        /* caller's name            */
  37.     LABEL lbpw;         /* caller's password            */
  38.     long  lbdownloadlimit;    /* # bytes the user can download today    */
  39.     short lbcalls;        /* # calls the user has made today    */
  40.     short lbtime;        /* # minutes of connect time today    */
  41.     short lbclosecalls;        /* # close calls the user has made    */
  42.     short lbreadnum;        /* default # msgs to read using .R<#>    */
  43.     time_t lblast;        /* last day the user logged in        */
  44.     long  lbvisit[MAXVISIT];    /* newestLo for this & a few prev. visits */
  45.     char  *lbgen;        /* 5 bits gen, 3 bits lastvisit        */
  46.     theMessages *lbmail;
  47. } ;
  48.  
  49. /*
  50.  * userlog flags (formerly struct lflags)
  51.  */
  52. #define uSYSOP         0x0001L    /* Sysop?            */
  53. #define uLINEFEEDS     0x0002L    /* Linefeeds?            */
  54. #define uEXPERT         0x0004L    /* Expert?            */
  55. #define uAIDE         0x0008L    /* Vice-Grand-Poobah?        */
  56. #define uINUSE         0x0010L    /* Is this slot in use?     */
  57. #define uSHOWTIME     0x0020L    /* Show time of msg creation?    */
  58. #define uLASTOLD     0x0040L    /* Print out last old on [N]ew?    */
  59. #define uNETPRIVS     0x0080L    /* User have net privileges?    */
  60. #define uFLOORMODE     0x0100L    /* using floor configuration?    */
  61. #define uTWIT         0x0200L    /* Twit?            */
  62. #define uPROTO1         0x0400L    /* Next 3 flags: default xfer    */
  63. #define uPROTO2         0x0800L    /* protocol.  000 == Xmodem    */
  64. #define uPROTO3         0x1000L
  65. #define uREADMORE     0x2000L    /* have read cmds use More: ?    */
  66. #define uNUMLEFT     0x4000L    /* display (n left) in msg hdr?    */
  67. #define uMAILPRIV     0x8000L    /* can use the Mail> room?    */
  68. #define uDOORPRIV    0x10000L    /* can use doors?        */
  69. #define uAUTONEW    0x20000L    /* auto-new msgs in Lobby>?    */
  70.  
  71. /* following put in by RH/AA 91Jan01 */
  72. /* High bit of 32-bit msgno value in lbmail is set iff the mail is received. */
  73. /* Use MAILNUM() to get a 'pure' msgno. */
  74. #define RECEIVED    0x80000000L
  75. #define MAILMSGMASK    0x7fffffffL
  76. #define MAILNUM(i)    (i & MAILMSGMASK)
  77.  
  78. #define LBGEN(p,x)    (((p).lbgen[x] >> GENSHIFT) & 0x1F)
  79.  
  80. struct lTable {         /* Summation of a person:        */
  81.     short ltpwhash;        /* hash of password            */
  82.     short ltnmhash;        /* hash of name             */
  83.     short ltlogSlot;        /* location in userlog.buf        */
  84.     long  ltnewest;        /* last message on last call        */
  85. } ;
  86.  
  87. /* Miscellaneous structure for linked list of userID names; RH 89Dec21    */
  88. struct user {
  89.     LABEL name;
  90.     struct user *next;
  91. };
  92.  
  93. #define initlogBuf(x)    (x)->lbgen = (char *)xmalloc(GEN_BULK),\
  94.             (x)->lbmail = (theMessages *)xmalloc(MAIL_BULK)
  95.  
  96. #define killlogBuf(x)    free((x)->lbgen), free((x)->lbmail)
  97.  
  98. #define copylogBuf(x, y)    memcpy(y, x, LB_SIZE),\
  99.             memcpy((y)->lbmail, (x)->lbmail, MAIL_BULK),\
  100.             memcpy((y)->lbgen, (x)->lbgen, GEN_BULK)
  101.  
  102.  
  103. #if defined(__STDC__) || defined(__cplusplus)
  104. # define _P(s) s
  105. #else
  106. # define _P(s) ()
  107. #endif
  108.  
  109. /* citlib\getlog.c */
  110. void getlog _P((struct logBuffer *p, int n, int file));
  111.  
  112. /* citlib\getnmidx.c */
  113. int getnmidx _P((char *name, struct logBuffer *log, int file));
  114. int getnmlog _P((char *name, struct logBuffer *log, int file));
  115.  
  116. /* citlib\putlog.c */
  117. void putlog _P((struct logBuffer *p, int n, int file));
  118.  
  119. #undef _P
  120.  
  121.  
  122.  
  123. #endif
  124.